package com.tianqu.tms.www.cardect.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tianqu.tms.core.base.Logger;
import com.tianqu.tms.core.base.TmsAction;
import com.tianqu.tms.core.base.UserContext;
import com.tianqu.tms.core.util.TmsConstants;
import com.tianqu.tms.entity.DectCodes;
import com.tianqu.tms.www.cardect.viewhelper.CarNormalDetectViewHelper;
/**
 * 普通检测报告信息确认页
 * 
 * @author tianshifu
 *
 */
public class CarWDPersonNormalDetectTopConfirmAction extends TmsAction {
	private Logger logger = Logger.getLogger(CarWDPersonNormalDetectTopConfirmAction.class);//log
	private static final String DETECT_INPUT_DATA = "detect_input_data";//检测录入信息

	@Override
	protected ActionForward doAction(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response,
			UserContext uc) throws Exception {
		logger.debug(this.getClass().getName() + "#execute was called.");	
		//对viewhelp中整车八大项进行处理	
		//从上个页面获取viewhelp打到前台
		CarNormalDetectViewHelper view = (CarNormalDetectViewHelper)uc.getAttribute(DETECT_INPUT_DATA);
		DectCodes code = DectCodes.getInstance();
		view.setSkylight(code.getItemValueByItemIdAndItemCode(DectCodes.EIGHT_VEHICLE_CONFIGURATION, view.getSkylight()));
		view.setLeatherSeats(code.getItemValueByItemIdAndItemCode(DectCodes.EIGHT_VEHICLE_CONFIGURATION, view.getLeatherSeats()));
		view.setAluminumRim(code.getItemValueByItemIdAndItemCode(DectCodes.EIGHT_VEHICLE_CONFIGURATION, view.getAluminumRim()));
		view.setGpsNavigation(code.getItemValueByItemIdAndItemCode(DectCodes.EIGHT_VEHICLE_CONFIGURATION, view.getGpsNavigation()));
		view.setAutoWindow(code.getItemValueByItemIdAndItemCode(DectCodes.EIGHT_VEHICLE_CONFIGURATION, view.getAutoWindow()));
		view.setAbs(code.getItemValueByItemIdAndItemCode(DectCodes.EIGHT_VEHICLE_CONFIGURATION, view.getAbs()));
		view.setSrsNumber(code.getItemValueByItemIdAndItemCode(DectCodes.EIGHT_VEHICLE_CONFIGURATION, view.getSrsNumber()));
		view.setFourWheelDrive(code.getItemValueByItemIdAndItemCode(DectCodes.EIGHT_VEHICLE_CONFIGURATION, view.getFourWheelDrive()));
		
		//事故车判定
		view.setDisasterCars(code.getItemValueByItemIdAndItemCode(DectCodes.TRAFFIC_CAR, view.getDisasterCars()));
		
		request.setAttribute(TmsConstants.VIEWHELP, view);
		logger.debug(this.getClass().getName() + "#doAction was completed.");
		return mapping.findForward(TmsConstants.SUCCESS);
	}

}
